from langchain.llms import OpenAI
from PyCmpltrtok.common import sep

llm = OpenAI(
    streaming=True,
    verbose=True,
    callbacks=[],
    openai_api_key="token1",
    openai_api_base=f"http://127.0.0.1:6001/v1",
    model_name="chatglm2-6b",
    temperature=1.0,
    openai_proxy=None,
    top_p=1.0,
)

if '__main__' == __name__:
    
    text = "我们来玩成语接龙。我先来。\n"
    text += "AI: 为所欲为\n"
    text += "用户: 围魏救赵\n"
    text += "AI:"
        
    xresult = llm.invoke(text)

    sep()
    print(xresult)
    sep()
